package polsl.biai.projekt.server.calculation;

import java.util.ArrayList;

/**
 * contains list of all cities added to the program
 * @author jacek
 *
 */
public class CityList {

	/**
	 * list of the cities
	 */
	private static ArrayList<City> cities = new ArrayList<City>();
	
	public CityList(){}

	/**
	 * adds one city to the list
	 * @param c
	 */
	public static void addCity(City c)
	{
		cities.add(c);
	}
	
	/**
	 * adds array of cities to the list
	 * @param _cities
	 */
	public static void addCity(City... _cities)
	{
		for(City c: _cities)
		{
			cities.add(c);
		}
	}
	

	/**
	 * adds list of cities to the list
	 * @param list
	 */
	public static void addCity(ArrayList<City> list)
	{
		cities=list;
	}
	
	public static City getCity(int i)
	{
		return cities.get(i);
	}
	
	/**
	 * deletes City from the list
	 * @param i
	 */
	public static void delCity(int i)
	{
		cities.remove(i);
	}
	
	/**
	 * checks if list contains City c
	 * @param c
	 * @return index of City c in CityList
	 */
	public static int contains(City c)
	{
		return cities.indexOf(c);
	}
	
	public static int numberOfCities()
	{
		return cities.size();
	}
	
	/**
	 * gets list
	 * @return
	 */
	public static ArrayList<City> getCities()
	{
		return cities;
	}
	
	/**
	 * clears list
	 */
	public static void clearCityList()
	{
		cities.clear();
	}
	
	

}
